home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
101-125
/
scopedisk113
/
arexx
/
getdiskname.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-03-19
|
3KB
|
73 lines
/*
This ARexx function gets the actual name of a disk.
I use this along with my fixdisk program to automatically check a new
unwarped disk for viruses, move ARP material to the volume, check and modify
the startup-sequence on that disk and numerous other things.
The main reason I need the actual name of the disk is that I save all
non-standard boot blocks, just in case I run across a new virus or something
else of interest. Since some disknames have a space in them, I put quotes
around the name to allow the real name to be saved.
I have a special directory to save all my non-standard boot blocks in,
and after I'm sure the ware runs with a standard boot block, I can delete
the non-standard block after looking at it.
*/
/*...........................THE FUNCTION .............. */
/* gdname.rexx....Gets name of disk */
/* arg = vol */
gdname:
arg vol
call setclip('DNAME',"")
/* GET INFO FOR THAT FLOPPY DRIVE */
""'info 'vol' | execio from 4 for 1 var diskinfo'
/* The above line gets one line of information about the disk you want
to check...
DF0: 880K 2 1756 0% 0 Read Only EMPTY 1 2 3
This is the line it gets and all I have to do through ARexx is to
look for Read/Write (seventh word on a disk that is not write-protected),
and on the above disk, which is read-only (it's write protected) I look for
'Only' which is the eighth word. Therefore, the actual name of the disk
begins with the ninth word and continues to the end of the string.
If you are unfamiliar with the 1.3 INFO command, study it. You can save
time by aliasing in your shell to
alias i = info df[]:
To get INFO on one floppy all you have to type is:
i 0
. . . for INFO on the disk in df0:
i 1
. . . for INFO on the disk in df1:
I also use:
alias ih = info dh[]:
. . . to get INFO on individual hard drive partions, since mine are
dh0: dh1: dh2: dh3: all I have to type is
Ih 0 .. IH 1 ... Ih 2.. IH 3... etc.
THe Rexx setclip/getclip is something like getenv/setenv from CBM.
If I used setenv, I could actually use it in a DOS script, but
since ARexx is faster and has more features, I rarely use DOS scripts
except for very very simple things.
*/
if compare(word(diskinfo,8),'Only') == 0 then diskname = subword(diskinfo,9,)
else diskname = subword(diskinfo,8,)
call setclip('DNAME','"' || diskname || '"')
return
/*..............................A CALLING TEST PROGRAM ............*/
/* test.rexx */
arg vol
call gdname vol /* call the aOve function to get the name of the disk */
say getclip('DNAME') /* say in Rexx is like the ECHO cmd */
/*
NOTE: again you can use ARexx without running wshell
by using Rx on the ARexx Disk.
you have to type "RX (rexx program name) args (if any)"
*/